class LocalStorage {
  setItem(key: string, val: any) {
    localStorage.setItem(key, JSON.stringify(val));
  }
  getItem(key: string) {
    const data = localStorage.getItem(key);
    return data ? JSON.parse(data as string) : "";
  }
  clear() {
    localStorage.clear();
  }
}

const storage = new LocalStorage();

export function useStorage() {
  return storage;
}

export function useToken() {
  return storage.getItem("token");
}
